<!--
 * @Author: your name
 * @Date: 2020-02-28 15:42:06
 * @LastEditTime: 2020-02-28 15:57:05
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \javascript_teaching\codes\chapter2\2-3.html
 -->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>计算账单金额</title>
    <script>
        var bj = 100;//标价
        var rate = 0.05;//税率
        var tax;//税金
        var total;//接收总金额的变量
        tax = bj * rate;//税金等于标价*税率
        total = bj + tax;//总金额等于标价加税金
        document.writeln("商品的总金额：" + total + "；");
        document.writeln("商品的税金为：" + tax + "。");
        
    </script>
</head>
<body>
    
</body>
</html>